﻿using System;
using System.Data.SQLite;
using System.IO;

namespace 工业设备监控系统.DAL
{
    public static class SqliteHelper
    {
        private static string _dbPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "monitor.db");

        /// <summary>
        /// 获取数据库连接字符串
        /// </summary>
        private static string ConnectionString => $"Data Source={_dbPath};Version=3;";

        /// <summary>
        /// 获取数据库连接对象
        /// </summary>
        /// <returns>打开的 SQLiteConnection</returns>
        public static SQLiteConnection GetConnection()
        {
            var connection = new SQLiteConnection(ConnectionString);
            connection.Open();
            return connection;
        }
    }
}